package com.kanesoft.android.gdx.actors.fight;

import com.kanesoft.android.gdx.widgets.sprites.SpriteInfo;

public class FighterFallingPunch extends FightActorStateMachine{
    
    private FightActorObject fightActor;
    
    public FighterFallingPunch(SpriteInfo stateSpriteInfo, FightActorObject actor) {
        super(stateSpriteInfo, actor);
        fightActor = actor;
    }

    @Override
    public boolean OnEnter() {
        
        if (fightActor.getActorState() != null) {
            if (fightActor.getActorState().equals(fightActor.jumpingState)) return false;
            if (fightActor.getActorState().equals(fightActor.fallingKickState)) return false;
            if (fightActor.getActorState().equals(fightActor.fallingPunchState)) return false;
        }
        if (actor.getWorldControl().isObjectOnTheGround(actor)) return false;
        
        
        actorSprite.setAnimationInLoop(true);
        actorSprite.setSpriteInfo(stateSpriteInfo);
        
        return true;
    }

    @Override
    public boolean  OnUpdate() {
        return fightActor.fallingState.OnUpdate();
    }

    @Override
    public String getStateName() {
        return "FallingPunch";
    }

}
